package ai.plantdata.Behavior.mode.StrategyPattern.test;

import ai.plantdata.Behavior.mode.StrategyPattern.classes.Context;
import ai.plantdata.Behavior.mode.StrategyPattern.interfaces.impl.OperationAdd;
import ai.plantdata.Behavior.mode.StrategyPattern.interfaces.impl.OperationMultiply;
import ai.plantdata.Behavior.mode.StrategyPattern.interfaces.impl.OperationSubtract;

/**
 * @Author: WangHui
 * @Date: 2020/12/23 17:16
 * @Description:
 */
public class StrategyPatternDemo {
    public static void main(String[] args) {
        Context context = new Context(new OperationAdd());
        System.out.println("10 + 5 = " + context.executeStrategy(10,5));

        context = new Context(new OperationSubtract());
        System.out.println("10 - 5 = " + context.executeStrategy(10,5));

        context = new Context(new OperationMultiply());
        System.out.println("10 * 5 = " + context.executeStrategy(10,5));

    }
}
